/**
 *
 * © Bahadir Zeren 2011
 * bzeren@gmail.com
 * No warranties, express or implied, are made for this program.
 *
 */
package org.baatar.remoting.test;

import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.Logger;
import org.apache.log4j.PatternLayout;
import org.baatar.remoting.service.RemotingService;
import org.baatar.remoting.test.impl.service.MathServiceImpl;

/**
 * Main program of the remote math service which initializes and runs it.
 * 
 * @author B_ZEREN
 */
public class RemotingMathServer {
    public static void main(String args[]) throws Exception {

        RemotingService remotingMathService = new RemotingService(new MathServiceImpl(), 4321);

        if (remotingMathService.initializeService()) {

            /**
             * Assign Logger.
             */
            Logger logger = Logger.getLogger(remotingMathService.getRemotingServiceInfo().toString());
            remotingMathService.setLogger(logger);
            logger.addAppender(new ConsoleAppender(new PatternLayout()));

            if (remotingMathService.startService()) {
                remotingMathService.getLogger().info("Ready.");
            }
        }
    }
}
